<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:composite="http://java.sun.com/jsf/composite"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
<composite:interface>
    <composite:attribute name="popupId" default="confirmPane"/>
    <composite:attribute name="fname" default="remove"/>
    <composite:attribute name="msg" required="true"/>
    <composite:attribute name="render" required="true"/>
    <composite:attribute name="okButton" default="#{msg['action.delete']}"/>
    <composite:attribute name="faction" method-signature="void action()" required="true"/>
</composite:interface>
<composite:implementation>
    <!--TODO 解决多个jsFunction的问题-->
    <a4j:jsFunction name="#{cc.attrs.fname}" id="#{cc.attrs.fname}" action="#{cc.attrs.faction}" limitRender="true"
                    render="#{cc.attrs.render}" execute="@this"
                    oncomplete="#{rich:component(cc.attrs.popupId)}.hide()"/>
    <rich:popupPanel id="#{cc.attrs.popupId}" autosized="true" header="#{msg['popup.headerMsg']}">
        <h:panelGrid columns="1" border="0">
            <h:outputText id="infoMsg" value="#{cc.attrs.msg}"/>
            <h:panelGroup columns="2" style="text-align: center;" layout="block">
                <a4j:commandButton id="okButton" execute="@none" render="@none"
                                   value="#{msg['action.delete']}" style="padding-left: 5px;"
                                   onclick="#{cc.attrs.fname}(); return false;" />
                <a4j:commandButton id="noButton" value="#{msg['action.cancel']}" execute="@none"
                                   render="@none" style="padding-right: 5px;"
                                   onclick="#{rich:component(cc.attrs.popupId)}.hide(); return false;"/>
            </h:panelGroup>
        </h:panelGrid>
    </rich:popupPanel>
</composite:implementation>
</html>